Crate forc_pkg

source ·
Expand description

Building, locking, fetching and updating sway projects as Forc packages.

A forc package represents a Sway project with a Forc.toml manifest file declared at its root. The project should consist of one or more Sway modules under a src directory. It may also declare a set of forc package dependencies within its manifest.

Re-exports§

Modules§

  • Related to pinning, fetching, validating and caching the source for packages.

Structs§

  • The set of options provided to the build functions.
  • Represents the full build plan for a project.
  • The result of successfully compiling a package.
  • The bytecode associated with a built package along with its entry points.
  • Compiled contract dependency parts relevant to calculating a contract’s ID.
  • The result of the compile function, i.e. compiling a single package.
  • The set of options to filter type of projects to build in a workspace.
  • The package descriptors that a BuiltPackage holds so that the source used for building the package can be retrieved later on.
  • A package uniquely identified by name along with its pinned source.
  • A unique ID for a pinned package.
  • Error returned upon failed parsing of PinnedId::from_str.
  • A package uniquely identified by name along with its source.
  • Represents a package entry point.
  • Data specific to the test entry point.
  • Contains the lexed, parsed, typed compilation stages of a program, as well as compilation metrics.

Enums§

Constants§

  • The name of the constant holding the contract’s id.
  • The suffix that helps identify the file which contains the hash of the binary file created when scripts are built_package.
  • The suffix that helps identify the file which contains the root hash of the binary file created when predicates are built_package.

Functions§

  • Build an entire forc package and return the built_package output.
  • Builds a project with given BuildOptions.
  • Compile the entire forc package and return the lexed, parsed and typed programs of the dependencies and project. The final item in the returned vector is the project.
  • The pkg::Graph is of a -> b where a depends on b. We can determine compilation order by performing a toposort of the graph with reversed weights. The resulting order ensures all dependencies are always compiled before their dependents.
  • Compiles the given package.
  • Returns the ContractId of a built_package contract with specified salt.
  • Builds the dependency namespace for the package at the given node index within the graph.
  • Format an error message if a given URL fails to produce a working node.
  • Format an error message for an absent Forc.toml.
  • Format an error message for failed parsing of a manifest.
  • Given a forc_pkg::BuildProfile, produce the necessary sway_core::BuildConfig required for compilation.
  • Format an error message if an incorrect program type is present.

Type Aliases§